<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html">
     <f:view xmlns:h="http://java.sun.com/jsf/html"
            xmlns:p="http://primefaces.org/ui"
            xmlns:f="http://java.sun.com/jsf/core" 
            xmlns:c="http://java.sun.com/jsp/jstl/core"
            xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Modular Arithmetic</title>
    </h:head>
    <h:body>
        <h:panelGroup>   
                    
                        <h:panelGrid columns="1" width="100%" border="1">
                            <h:form id="reverse_form">
                  <h:panelGroup>
                      <h:outputLabel value="Reverse element" />
                <h:panelGrid columns="2">
                <h:outputLabel value="Input number to reverse:" />
                <h:inputText value="#{galuaHelper.elementToReverse}" />
                <h:outputLabel value="Input N:" />
                <h:inputText value="#{galuaHelper.n}"/>
                <h:outputLabel value="Result:" />
                <h:outputLabel value="#{galuaHelper.reverseElement}" style="color: blue" />
                </h:panelGrid>
                      <h:commandButton value="Calculate">
                          <f:ajax execute=":reverse_form" render=":reverse_form" />
                      </h:commandButton>
                </h:panelGroup>
                            </h:form>
                             <h:form id="power_form">
                        <h:panelGroup>
                            <h:outputLabel value="Power" />
                            <h:panelGrid columns="2">
                <h:outputLabel value="number to be powered:" />
                <h:inputText value="#{galuaHelper.elementToPower}" />
                <h:outputLabel value="Power:" />
                <h:inputText value="#{galuaHelper.power}"/>
                <h:outputLabel value="N:" />
                 <h:inputText value="#{galuaHelper.n1}"/>
                 <h:outputLabel value="Result:" />
                 <h:outputLabel value="#{galuaHelper.powerResult}" style="color: blue"/>
                </h:panelGrid>
                <h:commandButton value="Calculate">
                          <f:ajax execute=":power_form" render=":power_form" />
                      </h:commandButton>
                        </h:panelGroup>
                                  </h:form>
                            <h:form id="eleptic_curve">
                            <h:panelGroup>
                       <h:outputLabel value="elliptic curves Values: Y^2 = X^3 +a*X + b" />
                       <h:panelGrid columns="2">
                <h:outputLabel value="Curve params:" />
                <h:panelGroup>
                     <h:outputLabel value="a:" />
                     <h:inputText value="#{galuaHelper.param1A}" />
                     <h:outputLabel value="b:" />
                     <h:inputText value="#{galuaHelper.param1B}"/>
                
                </h:panelGroup>
                 
                 <h:outputLabel value="N:" />
                 <h:inputText value="#{galuaHelper.curve1N}"/>
                 <h:outputLabel value="Result:" />
                 <h:outputLabel value="#{galuaHelper.curveValues}" style="color: blue"/>
                </h:panelGrid>
                <h:commandButton value="Calculate">
                          <f:ajax execute=":eleptic_curve" render=":eleptic_curve" />
                      </h:commandButton>
                     <h:outputLabel value="Get point subgroup" />
                     <h:outputLabel value="x:" />
                     <h:inputText value="#{galuaHelper.elemX}" />
                     <h:outputLabel value="y:" />
                     <h:inputText value="#{galuaHelper.elemY}" />
                     <h:outputLabel style="float: left;" value="Result: #{galuaHelper.subGroups}" />
                     
                        </h:panelGroup>
                                  </h:form> 
                            <h:form id="el_curve_summ">
                   <h:panelGroup>
                       <h:outputLabel value="elliptic curves" />
                            <h:panelGrid columns="2">
                <h:outputLabel value="Curve params:" />
                <h:panelGroup>
                     <h:outputLabel value="a:" />
                     <h:inputText value="#{galuaHelper.paramA}" />
                     <h:outputLabel value="b:" />
                     <h:inputText value="#{galuaHelper.paramB}"/>
                
                </h:panelGroup>
                 <h:outputLabel value="First Point:" />
                 <h:panelGroup>
                     <h:outputLabel value="x:" />
                     <h:inputText value="#{galuaHelper.x1}" />
                     <h:outputLabel value="y:" />
                     <h:inputText value="#{galuaHelper.y1}"/>
                
                </h:panelGroup>
                 <h:outputLabel value="Second Point:" />
                 <h:panelGroup>
                     <h:outputLabel value="x:" />
                     <h:inputText value="#{galuaHelper.x2}" />
                     <h:outputLabel value="y:" />
                     <h:inputText value="#{galuaHelper.y2}"/>
                
                </h:panelGroup>
                 <h:outputLabel value="N:" />
                 <h:inputText value="#{galuaHelper.curveN}"/>
                 <h:outputLabel value="Result:" />
                 <h:outputLabel value="#{galuaHelper.summOfCurve}" style="color: blue"/>
                </h:panelGrid>
                <h:commandButton value="Calculate">
                          <f:ajax execute=":el_curve_summ" render=":el_curve_summ" />
                      </h:commandButton>
                        </h:panelGroup>
                                 </h:form>
                            
                        </h:panelGrid>
                  
                </h:panelGroup>
    </h:body>
     </f:view>
</html>
